import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-09-30
 * Time: 14:04
 */
//线程池
public class Demo22 {
    public static void main(String[] args) {
        ExecutorService service= Executors.newFixedThreadPool(4);//固定数量的线程数
        for (int i = 0; i <50; i++) {
            service.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName() + "hello");
                }
            });
        }
    }
}
